package org.finesys.common.sms;

import org.finesys.common.sms.Service.SmsService;
import org.finesys.common.sms.properties.SmsProperties;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.core.StringRedisTemplate;

@AutoConfiguration
@EnableConfigurationProperties(SmsProperties.class)
public class SmsAutoConfig {

    @Bean
    @ConditionalOnMissingBean(SmsService.class)
    public SmsService smsService(SmsProperties smsProperties, StringRedisTemplate stringRedisTemplate) {
        return new SmsService(smsProperties, stringRedisTemplate);
    }
}
